#include <iostream>
#include "gtest/gtest.h"

#include "../src/leetcode/KthSearch.h"

TEST(ArrayTest, getKth)
{
	KthSearch *s = new KthSearch();
	int arr1[5] = {2, 5, 19, 34};
	int arr2[10] = {1, 4, 6, 8, 11, 14, 17, 20, 25, 50};
	int r = 0;

	r = s->getKth(arr1, 0, 4, arr2, 0, 9, 1);
	ASSERT_EQ(r, 1);
	r = s->getKth(arr1, 0, 4, arr2, 0, 9, 2);
	ASSERT_EQ(r, 2);
	r = s->getKth(arr1, 0, 4, arr2, 0, 9, 3);
	ASSERT_EQ(r, 4);
	r = s->getKth(arr1, 0, 4, arr2, 0, 9, 4);
	ASSERT_EQ(r, 5);
	r = s->getKth(arr1, 0, 4, arr2, 0, 9, 5);
	ASSERT_EQ(r, 6);
}